$(document).ready(
	function(){
		var shijian = 1000; //呼吸速度
		var jiange = 3000; //自动运动间隔时间

		//==========================
		// 以下不要改
		//==========================

		var nowimg = 0;
		var mytimer = null;

		//设置定时器的
		mytimer = window.setInterval(dongdong,jiange);


		$("#czrightbut").click(dongdong);

		//设置鼠标进入离开定时器开关的
		$("#czhuxi").mouseenter(
			function(){
				window.clearInterval(mytimer);
			}
		);
		$("#czhuxi").mouseleave(
			function(){
				mytimer = window.setInterval(dongdong,jiange);
			}
		);


		function dongdong(){
			if(nowimg < $("#czimg ul li").length - 1){
				nowimg = nowimg + 1;
			}else{
				nowimg = 0;
			}
			$("#czimg ul li").eq(nowimg - 1).animate({"opacity":0},shijian);
			$("#czimg ul li").eq(nowimg)    .animate({"opacity":1},shijian);

			//设置小圆点的语句：
			$("#czxinxi ul li").eq(nowimg).addClass("cur").siblings().removeClass("cur");
		}

		$("#czleftbut").click(
			function(){
				if(nowimg > 0){
					nowimg = nowimg - 1;
				}else{
					nowimg = $("#czimg li").length - 1;
				}
				
				if(nowimg == $("#czimg li").length - 1){
					$("#czimg ul li").eq(0).animate({"opacity":0},shijian);
					$("#czimg ul li").eq(nowimg)    .animate({"opacity":1},shijian);
				}else{
					$("#czimg ul li").eq(nowimg + 1).animate({"opacity":0},shijian);
					$("#czimg ul li").eq(nowimg)    .animate({"opacity":1},shijian);
				}

				//设置小圆点的语句：
				$("#czxinxi ul li").eq(nowimg).addClass("cur").siblings().removeClass("cur");
			}
		);

		$("#czxinxi ul li").click(
			function(){
				$("#czimg ul li").eq(nowimg).animate({"opacity":0},shijian);
				nowimg = $(this).index();
				$("#czimg ul li").eq(nowimg).animate({"opacity":1},shijian);

				//设置小圆点的语句：
				$("#czxinxi ul li").eq(nowimg).addClass("cur").siblings().removeClass("cur");
			}
		);
	}
);
